﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Weazel.Math;

#endregion

namespace Weazel.Math.Test
{
  [TestClass]
  public class TestUnsignedComparsion
  {
    /**************************************************************************
		 * Equals method
		 **************************************************************************/
    [TestMethod]
    public void TestEqualsMethod_1()
    {
      Assert.IsTrue(new Integer(8, 0, false).Equals(new Integer(8, 0, false)));
      Assert.IsFalse(new Integer(8, 0, false).Equals(new Integer(8, 1, false)));
    }

    /**************************************************************************
		 * Equals operator (==)
		 **************************************************************************/
    [TestMethod]
    public void TestEquals_1()
    {
      Assert.IsTrue(new Integer(8, 0, false) == new Integer(8, 0, false));
    }
    [TestMethod]
    public void TestEquals_2()
    {
      Assert.IsTrue(new Integer(8, 10, false) == new Integer(8, 10, false));
    }
    [TestMethod]
    public void TestEquals_3()
    {
      Assert.IsTrue(new Integer(8, 0, false) == new Integer(100, 0, false));
    }
    [TestMethod]
    public void TestEquals_4()
    {
      Assert.IsTrue(new Integer(8, 10, false) == new Integer(100, 10, false));
    }

		// mixed unsigned/signed
		[TestMethod]
		public void TestEqualsMixedSigns_1()
		{
			Integer a = new Integer(8, 34, false);
			Integer b = new Integer(8, 34, true);

			Assert.IsTrue(a == b);
		}

		[TestMethod]
		public void TestEqualsMixedSigns_2()
		{
			Integer a = new Integer(8, "0xFE", false);
			Integer b = new Integer(96, -1, true);

			Assert.IsTrue(a != b);
		}

    /**************************************************************************
		 * Not equals operator (!=)
		 **************************************************************************/
    [TestMethod]
    public void TestNotEquals_1()
    {
      Assert.IsFalse(new Integer(8, 0, false) != new Integer(8, 0, false));
    }
    [TestMethod]
    public void TestNotEquals_2()
    {
      Assert.IsFalse(new Integer(8, 10, false) != new Integer(8, 10, false));
    }
    [TestMethod]
    public void TestNotEquals_3()
    {
      Assert.IsFalse(new Integer(8, 0, false) != new Integer(100, 0, false));
    }
    [TestMethod]
    public void TestNotEquals_4()
    {
      Assert.IsFalse(new Integer(8, 10, false) != new Integer(100, 10, false));
    }

    /**************************************************************************
		 * Greater than operator (>)
		 **************************************************************************/
    [TestMethod]
    public void TestGreaterThan_1()
    {
      Assert.IsTrue(new Integer(8, 1, false) > new Integer(8, 0, false));
    }

    [TestMethod]
    public void TestGreaterThan_2()
    {
      Assert.IsTrue(new Integer(8, 100, false) > new Integer(8, 10, false));
    }

    [TestMethod]
    public void TestGreaterThan_3()
    {
      Assert.IsTrue(new Integer(8, 1, false) > new Integer(100, 0, false));
    }

    [TestMethod]
    public void TestGreaterThan_4()
    {
      Assert.IsTrue(new Integer(100, 1, false) > new Integer(8, 0, false));
    }

    /**************************************************************************
		 * Greater than or equal operator (>)
		 **************************************************************************/
    [TestMethod]
    public void TestGreaterThanOrEqual_1()
    {
      Assert.IsTrue(new Integer(8, 1, false) >= new Integer(8, 0, false));
    }

    [TestMethod]
    public void TestGreaterThanOrEqual_2()
    {
      Assert.IsFalse(new Integer(8, 0, false) >= new Integer(8, 1, false));
    }

    /**************************************************************************
		 * Less than or equal operator (>)
		 **************************************************************************/
    [TestMethod]
    public void TestLessThanOrEqual_1()
    {
      Assert.IsFalse(new Integer(8, 1, false) <= new Integer(8, 0, false));
    }

    [TestMethod]
    public void TestLessThanOrEqual_2()
    {
      Assert.IsTrue(new Integer(8, 0, false) <= new Integer(8, 1, false));
    }
  }
}
